feat: custom css option.#21
Conversation
|
Hey @y2w8, thanks for picking this up. Bugs1. The preview loads unstyled. The diff moves the bundled CSS into 2. content = content:gsub("</head>", "<style>\n" .. css .. "\n</style>\n</head>")In content = content:gsub("</head>", function() return "<style>\n" .. css .. "\n</style>\n</head>" end)Function returns are inserted literally, no escaping needed. Suggested designInstead of extracting the bundled CSS into a separate file, I think the cleaner approach is:
This pattern matches what most editor-class tools do (VSCode Want me to push a follow-up commit on your branch, or would you rather update yourself? |
|
Yes, please do and thanks for the detailed review. |
@selimacerbas Honestly I'm not very familiar with the Lua/Nvim APIs or live_server internals yet 😅 If you could implement those changes directly. Your proposed approach makes a lot more sense than my current implementation, especially the hot reload. I’ll handle making custom_css accept either a string or a list. |
Add custom CSS support
Moves the plugin's default styles out of
index.htmlinto a dedicatedassets/style.cssfile.On start, the stylesheet is inlined into the generated
index.htmlvia a<style>tag.A new
custom_cssconfig option lets users point to their own stylesheet: